package com.tbit.uqbike.object.pojo.vo;

import cn.hutool.core.collection.CollUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 站点运营统计-折线图统计vo
 *
 * @author <a href="mailto:yixingang@tbit.com.cn">yee_</a>
 * @version 1.0
 * @see <a href="#">#</a>
 * @since 2024/5/7
 */
@Data
@NoArgsConstructor
public class MachineOperationsStatChartVO {
    /**
     * 运营区域id
     */
    private Integer accountId;
    /**
     * 站点名称
     */
    private String accountName;
    /**
     * 时段数据列表
     */
    private List<MachineOperationsStatVO> dataList;

    public MachineOperationsStatChartVO(Integer accountId, String accountName) {
        this.accountId = accountId;
        this.accountName = accountName;
    }

    public void addData(MachineOperationsStatVO machineOperationsStatVO) {
        if (CollUtil.isEmpty(this.dataList)) {
            this.dataList = new ArrayList<>();
        }
        this.dataList.add(machineOperationsStatVO);
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class MachineOperationsStatVO {

        private Integer accountId;
        /**
         * 日期
         */
        private String dateStr;
        /**
         * 时段
         */
        private Integer timeSlot;

        /**
         * 骑行订单数
         */
        private Integer rideOrderCount;
        /**
         * 骑行金额 单位(元)
         */
        private BigDecimal rideMoneySum;


        public MachineOperationsStatVO(Integer accountId, String dateStr) {
            this(accountId, dateStr, null);
        }

        public MachineOperationsStatVO(Integer accountId, String dateStr, Integer timeSlot) {
            this.accountId = accountId;
            this.dateStr = dateStr;
            this.timeSlot = timeSlot;
            this.rideOrderCount = 0;
            this.rideMoneySum = BigDecimal.ZERO;
        }
    }


}
